package xcu.lxj.nettychat.chat.domain.dto;

import lombok.Data;
import lombok.NoArgsConstructor;
import xcu.lxj.nettychat.chat.domain.enums.WSPushTypeEnum;
import xcu.lxj.nettychat.chat.domain.vo.response.WSBaseResp;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

/**
 * @Author XinJian Lei
 * @Date 2024/9/26 16:53
 * @Version 1.0
 */
@Data
@NoArgsConstructor
public class PushMessageDTO implements Serializable {

    /**
     * 推送的ws消息
     */
    private WSBaseResp<?> wsBaseMsg;
    /**
     * 推送的uid
     */
    private List<Long> uidList;

    /**
     * 推送类型 1个人 2群
     * @see WSPushTypeEnum
     */
    private Integer pushType;


    public PushMessageDTO(List<Long> uidList, WSBaseResp<?> wsBaseMsg,Integer pushType) {
        this.uidList = uidList;
        this.wsBaseMsg = wsBaseMsg;
        this.pushType = pushType;
    }
    public PushMessageDTO(Long uid, WSBaseResp<?> wsBaseMsg) {
        this.uidList = Collections.singletonList(uid);
        this.wsBaseMsg = wsBaseMsg;
        this.pushType = WSPushTypeEnum.USER.getType();
    }

    public PushMessageDTO(List<Long> uidList, WSBaseResp<?> wsBaseMsg) {
        this.uidList = uidList;
        this.wsBaseMsg = wsBaseMsg;
        this.pushType = WSPushTypeEnum.USER.getType();
    }

    public PushMessageDTO(WSBaseResp<?> wsBaseMsg) {
        this.wsBaseMsg = wsBaseMsg;
        this.pushType = WSPushTypeEnum.ALL.getType();
    }
}
